package com.sinothk.android.utils.demo.net;

import androidx.appcompat.app.AppCompatActivity;

import android.content.IntentFilter;
import android.os.Bundle;

import com.sinothk.android.utils.demo.R;

public class NetDemoMainActivity extends AppCompatActivity {

    NetChangeReceiver netReceiver;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_net_demo_main);

        netReceiver = new NetChangeReceiver ();
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
        registerReceiver(netReceiver, intentFilter);
    }

    @Override
    public void onDestroy(){
        unregisterReceiver(netReceiver);
        super.onDestroy();
    }

}